package git.bankview.wl.console;

import laya.semi.process.*;

import git.bankview.sl.schedule.ScheduleCommon;
import git.bankview.wl.common.*;

//import org.apache.log4j.Logger;

public class TaskDependenceActivity extends SqlQueryActivityBase
{
	//private static Logger log = Logger.getLogger(TaskDependenceActivity.class);
   
	protected StringBuffer buildSqlBuffer(IProcessContext oCtx)
		throws Exception
	{
		String oTaskid = (String)oCtx.getField("taskid");
		String oDateKey = (String)oCtx.getField("datekey");
		
		StringBuffer oSql = new StringBuffer("SELECT");
		oSql.append("  ts.datekey")		//c01
			.append(", td.taskid")		//c02
			.append(", ts.execurl")		//c03
			.append(", ts.retrymax")	//c04
			.append(", ts.statuscode")	//c05
			.append(", ts.exectime")	//c06
			.append(", ts.termtime")	//c07
			.append(", ts.retrytimes")	//c08
			.append(", ts.errmsg")		//c09
			.append(", ts.taskdesc")	//c10
			.append(", ts.taskid deptaskid")	//c11
			.append(", ts.isignored")	//c12
			.append(" FROM taskschedule ts, taskdependence td")
			.append(" WHERE ts.datekey = ").append(ScheduleCommon.wrapDateSql(oDateKey))
			.append(" and ts.datekey = td.datekey")
			.append(" and td.taskid = '").append(oTaskid).append("'")
			.append(" and ts.taskid = td.deptaskid");
			
		return oSql;
	}
}
